<template>
  <mt-header :title="title">
      <span slot="left">
        <mt-button @click="goBack" icon="back">返回</mt-button>
      </span>
    <mt-button slot="right">
      <span class="iconfont icon-sousuo" @click="goIndexSearch"></span>
      <!--<span class="iconfont icon-ditu"></span>-->
    </mt-button>
  </mt-header>
</template>

<script>
  import Vue from 'vue';
  import {Header, Button} from 'mint-ui';

  Vue.component(Header.name, Header);
  Vue.component(Button.name, Button);
  export default {
    name: 'HouseTitle',
    props: {
      title: {
        type: String
      },
      searchId: {
        type: Number
      },
      formData: {
        type: Object,
        default: Object
      }
    },
    methods: {
      goBack() {
        this.$router.go(-1);
        this.$store.commit('setClearHouse');
        this.$store.commit('setClearHouseNew');
        if (this.$route.name === 'LookBuild') {
          // this.formData.renovation_id = '';
          // this.formData.type_is_apartment = '';//公寓
          // this.formData.type_is_ocean = '';//洋房
          // this.formData.type_is_villa = '';//别墅
          // this.formData.type_is_shops = '';//商铺
          // this.formData.type_is_office = '';//写字楼
          // this.formData.type_is_hotel = '';//酒店
          // this.formData.type_is_housing = '';//住宅
          // this.formData.floor_id_min = '';//楼层
          // this.formData.floor_id_max = '';
          // this.formData.developer = '';//开发商
          // this.formData.building_year_min = '';//房龄
          // this.formData.building_year_max = '';//房龄
          // this.formData.type_id = '';//室数
          // this.formData.orientation_id = '';//朝向
          // this.formData.floor_id_dc = '';//顶层
        }

      },
      //跳转到搜索页面
      goIndexSearch() {
        console.log(this.$route.name);
        if (this.$route.name === 'LookBuild') {
          this.$store.commit('setSearchType', '新楼盘');
        } else {
          this.$store.commit('setSearchType', '二手房');
        }

        this.$router.push({name: 'IndexSearch'});
      }

    }
  };
</script>

<style scoped>
  .information_details .mint-header {
    background-color: #e6191e;

  }
</style>
